package com.liu.proxy_studey.dynamicProxy_cglib;

import net.sf.cglib.proxy.Enhancer;

public class text {
    public static void main(String[] args) {

        Student student = new Student();

        /*StudentProxy studentProxy = new StudentProxy();
        Student proxy = (Student) studentProxy.CreateProxy(student);
        proxy.study();*/
        two();
    }
    public static void two(){
        StudentProxy studentProxy = new StudentProxy();
        Student student = new Student();
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(student.getClass());
        enhancer.setCallback(studentProxy);
        /* 使用有参构造 参数类型  参数值*/
        Student proxy = (Student) enhancer.create(new Class[]{String.class, Integer.class}, new Object[]{"张三", 10});
        proxy.study();
    }
}
